Skip to content

try smaller decomp table#328

Draft
pianpwk wants to merge 1 commit intometa-pytorch:mainfrom
pianpwk:pianpwk/small_decomp_table
Draft

try smaller decomp table#328
pianpwk wants to merge 1 commit intometa-pytorch:mainfrom
pianpwk:pianpwk/small_decomp_table

Conversation

@pianpwk
Copy link
Contributor

@pianpwk pianpwk commented Feb 28, 2026

No description provided.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 28, 2026

# _unsafe_view is not tagged as a view op but is semantically a reshape;
# its non-tensor shape args become invalid after sharding so skip costing.
if node.target == torch.ops.aten._unsafe_view.default:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be fixed in PyTorch? I'd expect _unsafe_view to have the is_view tag set?

Copy link
Contributor Author

@pianpwk pianpwk Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this is intentional? this flag prevents AOTAutograd from doing all the view-replay needed for functionalization.

From https://github.com/pytorch/pytorch/blob/960d2b693a031966158a7d7f5f6324cf15361f8f/aten/src/ATen/native/TensorShape.cpp#L4080-L4090:

// NOTE [ Unsafe View ]
// _unsafe_view() differs from view() in that the returned tensor isn't treated
// as a view for the purposes of automatic differentiation. (It's not listed in
// VIEW_FUNCTIONS in gen_inplace_or_view_type.py).  It's only safe to use if the
// `self` tensor is temporary. For example, the viewed tensor here (a + b) is
// discarded immediately after viewing:
//
//  res = at::_unsafe_view(a + b, size);
//
// This is a hack because in-place operations on tensors treated like views
// can be much more expensive than the same operations on non-view tensors.

But I think for autoparallel you want the "is_view", 0-cost semantics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants